/* ---------------------------------------------------------------------- */
/*	Accordion
 /* ---------------------------------------------------------------------- */

(function () {

    var $container = jQuery('.acc-container'),
        $trigger = jQuery('.acc-trigger');

    $container.hide();
    $trigger.first().addClass('active').next().show();

    var fullWidth = $container.outerWidth(true);
    $trigger.css('width', fullWidth);
    $container.css('width', fullWidth);

    $trigger.on('click', function (e) {
        if (jQuery(this).next().is(':hidden')) {
            $trigger.removeClass('active').next().slideUp(300);
            jQuery(this).toggleClass('active').next().slideDown(300);
        }
        e.preventDefault();
    });

    // Resize
    jQuery(window).on('resize', function () {
        fullWidth = $container.outerWidth(true)
        $trigger.css('width', $trigger.parent().width());
        $container.css('width', $container.parent().width());
    });

})();
